Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

위젯 다크 모드 추가 #384

Merged
merged 1 commit into from
Jan 12, 2025
Merged

위젯 다크 모드 추가 #384

merged 1 commit into from
Jan 12, 2025

Conversation

plgafhd
Copy link
Collaborator

@plgafhd plgafhd commented Jan 5, 2025

No description provided.

@plgafhd plgafhd requested a review from a team as a code owner January 5, 2025 04:05
Copy link
Collaborator Author

@plgafhd plgafhd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

대충 비교 사진..! 앱 내 시간표랑 색상은 똑같이 맞춰놨어

Comment on lines +136 to +142
val sharedPreferences = context.getSharedPreferences(SNUTTStorage.DOMAIN_SCOPE_CURRENT_VERSION, Context.MODE_PRIVATE)
val themeMode = sharedPreferences.getString("theme_mode", null) ?: ""
val isDarkMode = when (themeMode) {
"\"DARK\"" -> true
"\"LIGHT\"" -> false
else -> isSystemDarkMode(context)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

생각보다 앱 내 화면 모드를 가져오는게 어렵지 않았어
만약 그냥 시스템 모드를 가져오는거로 바꾼다면 저 isSystemDarkMode()만 쓰면 되는 상황

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어 isSystemDarkMode 이거 composable 함수인줄 알았는데 아니었구나 ㅋㅋㅋ 굳굳

Comment on lines +144 to +158
setBackgroundColor(
if (isDarkMode) Color.rgb(43, 43, 43) else Color.rgb(255, 255, 255),
)
linePaint.apply {
color = if (isDarkMode) Color.rgb(60, 60, 60) else Color.rgb(235, 235, 235)
}
subLinePaint.apply {
color = if (isDarkMode) Color.rgb(60, 60, 60) else Color.rgb(243, 243, 243)
}
hourLabelTextPaint.apply {
color = if (isDarkMode) Color.rgb(119, 119, 119) else Color.rgb(0, 0, 0)
}
dayLabelTextPaint.apply {
color = if (isDarkMode) Color.rgb(119, 119, 119) else Color.rgb(0, 0, 0)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color... 좀 마음에 안들게 가져오는데 SNUTTColors꺼를 갖다 쓰는게 안되니
개선한다면 그냥 상수로 들고 있다가 가져오는 정도...가 최선일것 같기도 하고...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

일단 싸게싸게 ㄱㄱ

Copy link
Collaborator

@JuTaK97 JuTaK97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아주훌륭

Copy link
Collaborator

@eastshine2741 eastshine2741 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고많았어 🧇🧇🧇

Comment on lines +139 to +140
"\"DARK\"" -> true
"\"LIGHT\"" -> false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 SharedPreference에 ThemeMode 저장할 때 큰따옴표도 같이 저장돼??
직렬화할 때 MoshiSerializer#serialize() 타는 거 같은데 moshi가 그렇게 동작하는건가

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

음 그러게 ThemeMode가 Enum이라 그런가
저장할 때 직렬화를 하는데, getSharedPreferences로 가져와서 그럴까..?
이유는 생각 안해보긴 했어.. ㅋㅋㅋㅋ

@plgafhd plgafhd merged commit 9646466 into develop Jan 12, 2025
3 checks passed
@plgafhd plgafhd deleted the plgafhd/widget-darkmode branch January 12, 2025 15:52
plgafhd added a commit that referenced this pull request Jan 14, 2025
plgafhd added a commit that referenced this pull request Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants